<template>
  <!-- hidden PageHeaderWrapper title demo -->
  <page-header-wrapper :title="false">
    <a-card :body-style="{padding: '24px 32px'}" :bordered="false">
      <a-alert
        message="错误提示"
        type="error"
        class="tips">
        <p slot="description">
          您收到 <span style="color: red">{{ tableData.length }}条退回修改消息</span>，请修改后尽快导入新的数据。
        </p>
      </a-alert>
      <a-table
        :columns="columns"
        :data-source="tableData"
        :loading="loading"
        bordered>
      </a-table>
    </a-card>
  </page-header-wrapper>
</template>

<script>
import { getMessage } from '@/api/message'
export default {
  name: 'BaseForm',
  data () {
    return {
      loading: true,
      columns: [{
        title: '退回日期',
        key: 'backTime',
        dataIndex: 'backTime'
      },
      {
        title: '退回原因',
        key: 'reason',
        dataIndex: 'reason'
      }],
      tableData: []
    }
  },
  mounted () {
    this.getData()
  },
  methods: {
    getData () {
      return new Promise((resolve, reject) => {
        getMessage().then(response => {
          this.tableData = response.result
          this.loading = false
          resolve()
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}
</script>
<style lang="less" scoped>
  .tips {
    margin-bottom: 20px;
  }
</style>
